Skip to content

Conversation

@daniel-lxs
Copy link
Member

@daniel-lxs daniel-lxs commented Jul 14, 2025

Description

This PR adds support for Google's new gemini-embedding-001 model to the code-index service. This model provides state-of-the-art performance across English, multilingual, and code tasks, unifying previously specialized models.

Changes Made

  • Added gemini-embedding-001 to embedding model profiles with correct output dimension of 3072
  • Updated GeminiEmbedder class to support multiple models via constructor parameter instead of being hardcoded
  • Set gemini-embedding-001 as the default Gemini embedding model
  • Updated service-factory to pass the modelId parameter to GeminiEmbedder
  • Removed hardcoded dimension logic for Gemini provider in service-factory
  • Updated all tests to support the new model parameter and correct dimensions

Model Specifications

  • Model Name: gemini-embedding-001
  • Output Dimensions: 3072
  • Max Sequence Length: 2048 tokens
  • Description: State-of-the-art performance across English, multilingual and code tasks

Testing

  • All unit tests pass for GeminiEmbedder
  • All unit tests pass for service-factory
  • Linting and type checking pass

UI Support

The existing CodeIndexPopover component already supports displaying Gemini models in a dropdown, so users will automatically see both available models:

  • text-embedding-004 (768 dimensions)
  • gemini-embedding-001 (3072 dimensions)

Breaking Changes

None. The changes are backward compatible - existing configurations using text-embedding-004 will continue to work.


Important

Add support for gemini-embedding-001 model to code-index service, updating GeminiEmbedder and tests for multiple model handling.

  • Behavior:
    • Add gemini-embedding-001 model to embeddingModels.ts with dimension 3072.
    • Set gemini-embedding-001 as default model in getDefaultModelId().
    • Update GeminiEmbedder to accept model ID via constructor, defaulting to gemini-embedding-001.
    • Update createEmbeddings() in GeminiEmbedder to use instance or provided model.
  • Service Factory:
    • Update createEmbedder() in service-factory.ts to pass model ID to GeminiEmbedder.
    • Remove hardcoded dimension logic for Gemini in createVectorStore().
  • Testing:
    • Update tests in service-factory.spec.ts and gemini.spec.ts to handle new model parameter and dimensions.
    • Ensure all tests pass with new model configurations.

This description was created by Ellipsis for fe877f9. You can customize this summary. It will automatically update as commits are pushed.

- Add gemini-embedding-001 with 3072 dimensions to EMBEDDING_MODEL_PROFILES
- Update GeminiEmbedder to support multiple models via constructor parameter
- Set gemini-embedding-001 as the default Gemini model
- Update service-factory to pass modelId to GeminiEmbedder
- Remove hardcoded dimension logic for Gemini provider
- Update tests to support new model parameter and correct dimensions

The new model provides state-of-the-art performance across English, multilingual and code tasks, unifying previously specialized models.
@daniel-lxs daniel-lxs requested review from cte, jr and mrubens as code owners July 14, 2025 17:55
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. enhancement New feature or request labels Jul 14, 2025
@daniel-lxs daniel-lxs moved this from Triage to PR [Needs Review] in Roo Code Roadmap Jul 14, 2025
@delve-auditor
Copy link

delve-auditor bot commented Jul 14, 2025

No security or compliance issues detected. Reviewed everything up to 4c71f27.

Security Overview
  • 🔎 Scanned files: 5 changed file(s)
Detected Code Changes
Change Type Relevant files
Enhancement ► src/services/code-index/embedders/gemini.ts
    Add support for gemini-embedding-001 model
► src/shared/embeddingModels.ts
    Add gemini-embedding-001 model profile
► src/services/code-index/service-factory.ts
    Update GeminiEmbedder initialization to support model selection
Refactor ► src/services/code-index/tests/service-factory.spec.ts
    Update tests for model dimension handling
► src/services/code-index/embedders/tests/gemini.spec.ts
    Update tests for model configuration

Reply to this PR with @delve-auditor followed by a description of what change you want and we'll auto-submit a change to this PR to implement it.

Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
@mrubens mrubens merged commit d7787a2 into main Jul 14, 2025
14 checks passed
@mrubens mrubens deleted the feat/add-gemini-embedding-001 branch July 14, 2025 18:10
@github-project-automation github-project-automation bot moved this from PR [Needs Review] to Done in Roo Code Roadmap Jul 14, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Jul 14, 2025
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Jul 14, 2025
@Jopo-JP Jopo-JP mentioned this pull request Jul 15, 2025
7 tasks
chrarnoldus added a commit to Kilo-Org/kilocode that referenced this pull request Jul 16, 2025
fxcl added a commit to tameslabs/Roo-Cline that referenced this pull request Jul 16, 2025
* main:
  fix: Resolve confusing auto-approve checkbox states (RooCodeInc#5602)
  fix: prevent empty mode names from being saved (RooCodeInc#5766) (RooCodeInc#5794)
  Format time in ISO 8601 (RooCodeInc#5793)
  fix: resolve DirectoryScanner memory leak and improve file limit handling (RooCodeInc#5785)
  Fix settings dirty check (RooCodeInc#5779)
  feat: increase Ollama API timeout values and extract as constants (RooCodeInc#5778)
  fix: Exclude Terraform and Terragrunt cache directories from checkpoints (RooCodeInc#4601) (RooCodeInc#5750)
  Move less commonly used provider settings into an advanced dropdown (RooCodeInc#5762)
  feat: Add configurable error & repetition limit with unified control (RooCodeInc#5654) (RooCodeInc#5752)
  list-files must include at least the first-level directory contents (RooCodeInc#5303)
  Update evals repo link (RooCodeInc#5758)
  Feature/vertex ai model name conversion (RooCodeInc#5728)
  fix(litellm): handle baseurl with paths correctly (RooCodeInc#5697)
  Add telemetry for todos (RooCodeInc#5746)
  feat: add undo functionality for enhance prompt feature (fixes RooCodeInc#5741) (RooCodeInc#5742)
  Fix max_tokens limit for moonshotai/kimi-k2-instruct on Groq (RooCodeInc#5740)
  Changeset version bump (RooCodeInc#5735)
  Add changeset for v3.23.12 patch release (RooCodeInc#5734)
  Update the max-token calculation in model-params to use the shared logic (RooCodeInc#5720)
  Changeset version bump (RooCodeInc#5719)
  chore: add changeset for v3.23.11 patch release (RooCodeInc#5718)
  Add Kimi K2 model and better support (RooCodeInc#5717)
  Fix: Remove invalid skip-checkout parameter from GitHub Actions workflows (RooCodeInc#5676)
  feat: add Cmd+Shift+. keyboard shortcut for previous mode switching (RooCodeInc#5695)
  Changeset version bump (RooCodeInc#5708)
  chore: add changeset for v3.23.10 patch release (RooCodeInc#5707)
  Add padding to the index model options (RooCodeInc#5706)
  fix: prioritize built-in model dimensions over custom dimensions (RooCodeInc#5705)
  Update CHANGELOG.md
  Changeset version bump (RooCodeInc#5702)
  chore: add changeset for v3.23.9 patch release (RooCodeInc#5701)
  Tweaks to command timeout error (RooCodeInc#5700)
  Update contributors list (RooCodeInc#5639)
  feat: enable Claude Code provider to run natively on Windows (RooCodeInc#5615)
  feat: Add configurable timeout for command execution (RooCodeInc#5668)
  feat: add gemini-embedding-001 model to code-index service (RooCodeInc#5698)
  fix: resolve vector dimension mismatch error when switching embedding models (RooCodeInc#5616) (RooCodeInc#5617)
  fix: [5424] return the cwd in the exec tool's response so that the model is not lost after subsequent calls (RooCodeInc#5667)
  Changeset version bump (RooCodeInc#5670)
  chore: add changeset for v3.23.8 patch release (RooCodeInc#5669)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request lgtm This PR has been approved by a maintainer PR - Needs Review size:L This PR changes 100-499 lines, ignoring generated files.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

4 participants